package com.ssy.lingxi.platform.template.service.controller.web;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.service.entity.door.MemberSelf;
import com.ssy.lingxi.platform.template.service.model.dto.common.MemberIdDTO;
import com.ssy.lingxi.platform.template.service.model.dto.web.SaveSelfDTO;
import com.ssy.lingxi.platform.template.service.model.vo.web.MemberSelfMainVO;
import com.ssy.lingxi.platform.template.service.service.web.MemberSelfWebService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @menu web - 会员自营门户
 * @author fhj
 * @version 2.0.0
 * @date 2021/10/18
 */
@Api(tags = "web - 会员自营门户")
@RestController
@RequestMapping("/template/web/memberSelfWeb")
public class MemberSelfWebController extends BaseController {

    @Resource
    private MemberSelfWebService memberSelfWebService;

    @ApiOperation(value = "保存当前登录会员的自营门户")
    @PostMapping("/saveCurrMemberSelf")
    public Wrapper<Void> saveCurrMemberSelf(@RequestBody @Valid SaveSelfDTO dto) {
        return memberSelfWebService.saveCurrMemberSelf(dto, getSysUser());
    }

    @ApiOperation(value = "获取当前登录会员的自营门户")
    @GetMapping("/findCurrMemberSelf")
    public Wrapper<MemberSelf> findCurrMemberSelf() {
        return memberSelfWebService.findCurrMemberSelf(getSysUser());
    }

    @ApiOperation(value = "自营门户主页")
    @GetMapping("/memberSelfMain")
    public Wrapper<MemberSelfMainVO> memberSelfMain(@Valid MemberIdDTO dto) {
        return memberSelfWebService.memberSelfMain(dto);
    }
}